import re

words = []

with open('coca7000.txt', 'r', encoding='utf-8') as f:
    for line in f:
        if line and not line == '\n':
            m = re.search('(\d+\s{1,3})([a-zA-Z]+)(\s{1,3}[a-z]{1})', line)
            if m:
                words.append([m.group(2),m.group(1).strip()])
                # print('{},{}'.format(m.group(2),m.group(1).strip()))

with open('coca7000list.txt','a',encoding='utf-8') as wf:
    for one in words:
        wf.write('{},{}\n'.format(one[0], one[1]))
        
